package com.atguigu.test.config;

import com.atguigu.test.aware.MyInitializingBean;
import com.atguigu.test.po.A;
import com.atguigu.test.po.B;
import com.atguigu.test.po.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * @author zp
 * @version 1.0
 * @description: 基于全注解的配置类
 * @date 2022/9/7 19:00
 */
@Configuration //这是一个配置类
@ComponentScan("com.atguigu.test.po")
//@EnableAspectJAutoProxy(exposeProxy=true) //开启AOP功能
//@ComponentScan(basePackages = {"com.atguigu.test.*"}) //扫描包
public class SpringConfig {
    @Bean
    public B b(){
        return new B();
    }

    @Bean
    public A a(){
        return new A();
    }

    @Bean
    public User user(){
        return new User();
    }

    @Bean(initMethod = "initBean")
    public MyInitializingBean myInitializingBean(){
        return new MyInitializingBean();
    }
}
